<script type="text/javascript">
	$(function(){
        $('#service').change(function(e){
        	$('#processtbody').empty();
        	var serviceId = $(this).children('option:selected').val();        	
        	if(serviceId && serviceId != ''){
        		$.DWZajax({
                    url:hostUrl +"/andonEvent/getEventProcessByServiceId",
                    data:{'serviceId':serviceId,
                    	'eventCode':$('input[name="id"]').val()
                    	},
                    callback:function(data){
                    	if(!data){
                    		alertMsg.error(data);
                    	} else{
                    		for(var i=0; i<data.length; i++){
                            	$('#processtbody').append('<tr>'
                            			+ '<td width="22"><input name="ids" value="'
                            			+ data[i].KEY
                            			+ '" type="checkbox" disabled="disabled" '
                            			+ data[i].CHECKED
                            			+ '></td>'
                            			+ '<td width="100">'
                            			+ data[i].KEY
                            			+ '</td>'
                            			+ '<td width="100">'
                            			+ data[i].VALUE
                            			+ '</td>');                   			 
                            }
                    	}                 	
                    }
                });
        	}
        });
        $('#service').trigger('change');
    });
</script>
<div class="pageContent">
    <form method="post"
        action="${rc.getContextPath()}/manage/andonEvent/save"
        class="pageForm required-validate"
        onsubmit="return validateCallback(this, dialogAjaxDone);">
        <div class="pageFormContent">
        	<input type="hidden" name="navTabId" value="${navTabId!''}">
        	<input type="hidden" name="id" value="${andonEvent.eventCode!''}">
        	<fieldset>
                <dl>
                    <dt  style="width: 120px;"><@label key="eventCode.C,colon">事件编号</@label></dt>
                    <dd>
                        <input name="eventCode" size="22" type="text" maxlength="20" 
                        class="required alphanumeric toUp"  warn="<@label key='eventCode.C,alreadyExists'>事件编号已存在</@label>"    
                            value="${andonEvent.eventCode!''}"   
                        readonly="readonly"                 
                        /><!-- TODO -->
                    </dd>
                </dl>
                <dl>
                    <dt  style="width: 120px;"><@label key="eventText.C,colon">事件描述</@label></dt>
                    <dd>
                        <input name="eventText" size="22" type="text" maxlength="60" class="required" readonly="readonly"
                        value="${andonEvent.eventText!''}" />
                    </dd>
                </dl>
                <dl class="defectLookup">
                    <dt style="width: 120px;"><@label key="service.C,colon">服务</@label></dt>
                    <dd>
                    	<select name="service" id="service" class="required" disabled="disabled">
                    		<option value="" ><@label key='select.C'>请选择</@label></option>
                            <#list serviceList  as serv>
                            <option value="${serv.id}"<#if  (andonEvent.service)?? && serv.id == andonEvent.service> selected="selected"</#if>>${serv.serviceName}</option>
                            </#list>
                        </select>
                    </dd>
                </dl>
                <dl class="nowrap">
                    <dd>
                       
                        <div  class="panel"  currentIndex="0" eventType="click" style="width: 605px;margin: 0;">
                        <h1><@label key="relatedProcess.C">关联的流程</@label></h1>
                        <div>
                                    <table class="table border" width="100%" layoutH="270">
                                        <thead>
                                        	<tr>
                                        		<th width="22"><input type="checkbox" group="ids" class="checkboxCtrl" disabled="disabled"></th>
                                                <th width="100"><@label key="code.C">编号</@label></th>
                                                <th width="100"><@label key="name.C">名称</@label></th>
                                            </tr>
                                        </thead>
                                        <tbody id="processtbody">
                                            <!-- <tr>
                                            	<td width="22"><input name="ids" value="${andonEvent.eventCode!''}" type="checkbox"></td>
                                            	<td width="100"></td>
                                            	<td width="100"></td>
                                            </tr> -->
                                        </tbody>
                                    </table>
                                    </div>
                        </div>
                    </dd>
                </dl>
        	</fieldset>
        </div>
		<#assign createInfo=andonEvent>
		<#include "/common/createInfo.html">
        <div class="formBar">
            <ul>
                <li>
				<div class="buttonActive">
					<div class="buttonContent">
						<button type="button" class="close" onclick="beforeClose();"><@label key="close.B">关闭</@label></button>
					</div>
				</div>
                </li>
            </ul>
        </div>
    </form>
</div>